package msg

import (
	"github.com/name5566/leaf/network/protobuf"
)

const (
	MSG_ERROR uint32 = 100
	MSG_LOGIN        = iota + 9999
	MSG_USERINFO
	MSG_CREATEROOM
	MSG_JOINROOM
	MSG_JoinRoomS2C
	MSG_EnterRoomS2C
	MSG_ExitRoom
	MSG_ExitRoomS2C
	MSG_MsgChangeEgg
	MSG_ChangeEggS2C
	MSG_UseItem_old
	MSG_UseItemS2C_old
	MSG_EggBoomS2C
	MSG_RoomStateS2C
	MSG_RobotS2C
	MSG_CancleRobot
	MSG_PING
	MSG_PONG
	MSG_RoomStart
	MSG_ChangeBird
	MSG_ChangeBirdS2C
	MSG_ChangeName
	MSG_ChangeNameS2C
	MSG_OnRank
	MSG_OnRankS2C
	MSG_OnFriendIngo
	MSG_OnFriendIngoS2C
	MSG_UseItem
	MSG_UseItemS2C
	MSG_UseItemResult
	MSG_UseItemResultS2C
	MSG_UseActionS2C
)


// 使用 Protobuf 消息处理器
var Processor = protobuf.NewProcessor()

func init() {
	// 注册错误消息
	Processor.Register(&MsgError{}, MSG_ERROR)
	// 注册登陆消息
	Processor.Register(&MsgLogin{}, MSG_LOGIN)
	// 注册玩家自己的信息
	Processor.Register(&MsgUserInfo{}, MSG_USERINFO)
	// 注册创建房间消息
	Processor.Register(&MsgCreateRoom{}, MSG_CREATEROOM)

	Processor.Register(&MsgJoinRoom{}, MSG_JOINROOM)
	Processor.Register(&MsgJoinRoomS2C{}, MSG_JoinRoomS2C)
	Processor.Register(&MsgEnterRoomS2C{}, MSG_EnterRoomS2C)
	Processor.Register(&MsgExitRoom{}, MSG_ExitRoom)
	Processor.Register(&MsgExitRoomS2C{}, MSG_ExitRoomS2C)
	Processor.Register(&MsgChangeEgg{}, MSG_MsgChangeEgg)
	Processor.Register(&MsgChangeEggS2C{}, MSG_ChangeEggS2C)
	Processor.Register(&MsgEggBoomS2C{}, MSG_EggBoomS2C)
	Processor.Register(&MsgRoomStateS2C{}, MSG_RoomStateS2C)
	Processor.Register(&MsgRobotS2C{}, MSG_RobotS2C)
	Processor.Register(&MsgCancleRobot{}, MSG_CancleRobot)
	Processor.Register(&PING{}, MSG_PING)
	Processor.Register(&PONG{}, MSG_PONG)
	Processor.Register(&MsgRoomStart{}, MSG_RoomStart)
	Processor.Register(&MsgChangeBird{}, MSG_ChangeBird)
	Processor.Register(&MsgChangeBirdS2C{}, MSG_ChangeBirdS2C)
	Processor.Register(&MsgChangeName{}, MSG_ChangeName)
	Processor.Register(&MsgChangeNameS2C{}, MSG_ChangeNameS2C)
	Processor.Register(&MsgOnRank{}, MSG_OnRank)
	Processor.Register(&MsgOnRankS2C{}, MSG_OnRankS2C)
	Processor.Register(&MsgOnFriendIngo{}, MSG_OnFriendIngo)
	Processor.Register(&MsgOnFriendIngoS2C{}, MSG_OnFriendIngoS2C)

	Processor.Register(&MsgUseItem{}, MSG_UseItem)
	Processor.Register(&MsgUseItemS2C{}, MSG_UseItemS2C)
	Processor.Register(&MsgUseItemResult{}, MSG_UseItemResult)
	Processor.Register(&MsgUseItemResultS2C{}, MSG_UseItemResultS2C)
	Processor.Register(&MsgUseActionS2C{}, MSG_UseActionS2C)



}
